<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<script src="js/mui.min.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link href="css/style.css" rel="stylesheet" />
		<script type="text/javascript" src="./js/common.js"></script>
	</head>
	<body>
		<div class="mui-content mui-scroll-wrapper" id="refreshContainer">
			<div class="mui-scroll">
				<div class="bg-dark mui-text-center pdt-5 pdb-5 pos-relative logo-content">
					<div class="bg-dark flex flex-jc-around pdt-10 pd-10 pos-relative">
						<img src="./img/arbicap_logo.png" style="height: 80px" alt="">
						<h1 style="height: 80px;line-height: 80px;" class="cl-white">阿尔卑斯</h1>
					</div>
				</div>
				<ul class="mui-table-view recharge">
					<!-- 提现记录 -->
				</ul>
			</div>
		</div>
		<script>
			mui('.logo-content').on('click','div',function(){
				location.href = './index.html'
			})
			
			let page = 1
			mui.init({
				pullRefresh: {
					container: '#refreshContainer', //待刷新区域标识，querySelector能定位的css选择器均可，比如：id、.class等
					up: {
						height: 50, //可选.默认50.触发上拉加载拖动距离
						auto: false, //可选,默认false.自动上拉加载一次
						contentrefresh: "正在加载...", //可选，正在加载状态时，上拉加载控件上显示的标题内容
						contentnomore: '没有更多数据了', //可选，请求完毕若没有更多数据时显示的提醒内容；
						callback: function() {
							page++
						}
					}
				}
			});
			const id = localStorage.getItem('MEMBERS')
			mui.ajax(HOST + 'v1/withdraw-list', {
				data: {
					page: page,
					members_id: id
				},
				type: 'get', //HTTP请求类型
				timeout: 10000, //超时时间设置为10秒；
				success: function(res) {
					//服务器返回响应，根据响应结果，分析是否登录成功；
					if (res.result === 0) {
						const data = res.data.list
						let html = ''
						if (page === 1) {
							html = ''
						} else {
							html = mui('.recharge')[0].innerHTML
						}
						let totalPage = res.data.pages.totalPage
						if (page >= totalPage) {
							mui('#refreshContainer').pullRefresh().endPullupToRefresh(true);
						}
						if (data.length > 0) {
							data.forEach((item) => {
								html +=
									`
							<li class="mui-table-view-cell">
								<p class="w100 flex flex-jc-start">提现金额：￥${item.money}</p>
								<p class="w100 flex flex-jc-start">提现银行：${item.bank_name}</p>
								<p class="w100 flex flex-jc-start">提现日期：${item.create_date}</p>
								<p>状态：${item.status==1?'待审核':(item.status==2?'审核通过':'审核不通过')}</p>
							</li>
							`
							})
						}
						mui('.recharge')[0].innerHTML = html
					} else {
						mui.toast(res.message, {
							duration: 'long',
							type: 'div'
						})
					}
				},
				error: function(xhr, type, errorThrown) {
					mui.toast(errorThrown, {
						duration: 'long',
						type: 'div'
					})
				}
			});
		</script>
	</body>
</html>
